package com.kll.tv.views.fragment.main

import android.view.View
import com.kll.carolinehmibiz.presentation.BasePresenter
import com.kll.tv.base.views.MainBaseFragment
import com.kll.tv.databinding.FragmentMainSearchBinding
import com.tencent.qcloud.tuicore.util.SoftKeyBoardUtil


/**
 * ====================================================
 * Created by Ziliang Cai on 2021/12/7 22:19
 * <a href="mailto:752577456@qq.com">Contact me</a>
 * ====================================================
 */
class MainContentSearchFragmengt: MainBaseFragment<BasePresenter>() {

    private lateinit var binding: FragmentMainSearchBinding

    override fun createPresenter(): BasePresenter {
        return BasePresenter(requireContext())
    }

    override fun initViewBinding(): View {
        binding = FragmentMainSearchBinding.inflate(layoutInflater)
        return binding.root
    }

    override fun init() {

        initListener()
    }

    private fun initListener() {
        binding.editTextTextPersonName.setOnFocusChangeListener(object : View.OnFocusChangeListener {
            override fun onFocusChange(v: View?, hasFocus: Boolean) {
                if (!hasFocus) {
                    SoftKeyBoardUtil.hideKeyBoard(binding.editTextTextPersonName.windowToken)
                } else {
                    SoftKeyBoardUtil.showSoftInput(binding.editTextTextPersonName)
                }
            }

        })
    }
}